package com.ft.adbix.core.base;

import androidx.annotation.Keep;

import com.ft.adbix.core.request.AdPosition;
import com.ft.adbix.core.request.App;
import com.ft.adbix.utils.data.gather.util.DataGatherUtil;
import com.ft.adbix.utils.data.synchronize.entity.DeviceData;

public class AdParams {
    private String reqId;
    private AdPosition adPosition;
    private App app;
    private DeviceData device;
    private int bidFloor;
    private boolean httpsRequired;

    @Keep
    public static class Builder{
        AdParams adParams;
        AdPosition adPosition;
        public Builder(){
            adParams = new AdParams();
            adPosition = new AdPosition();
        }
        public Builder setPosId(String posId){
            adPosition.setAdPositionId(posId);
            return this;
        }
        public Builder setAdSize(int width,int height){
            adPosition.setAdWidth(width);
            adPosition.setAdHeight(height);
            return this;
        }
        public Builder setReqId(String reqId){
            adParams.setReqId(reqId);
            return this;
        }

        public AdParams build(){
            adParams.setAdPosition(adPosition);
            //更新电量信息
            DataGatherUtil.gatherBatteryData(DataGatherUtil.currentDeviceData);
            //更新位置信息
            DataGatherUtil.gatherLocationAndStationData(DataGatherUtil.currentDeviceData);
            adParams.setDevice(DataGatherUtil.currentDeviceData);
            return adParams;
        }
    }

    public String getReqId() {
        return reqId;
    }

    public void setReqId(String reqId) {
        this.reqId = reqId;
    }

    public AdPosition getAdPosition() {
        return adPosition;
    }

    public void setAdPosition(AdPosition adPosition) {
        this.adPosition = adPosition;
    }

    public App getApp() {
        return app;
    }

    public void setApp(App app) {
        this.app = app;
    }

    public DeviceData getDevice() {
        return device;
    }

    public void setDevice(DeviceData device) {
        this.device = device;
    }

    public int getBidFloor() {
        return bidFloor;
    }

    public void setBidFloor(int bidFloor) {
        this.bidFloor = bidFloor;
    }

    public boolean isHttpsRequired() {
        return httpsRequired;
    }

    public void setHttpsRequired(boolean httpsRequired) {
        this.httpsRequired = httpsRequired;
    }
}
